package com.nikolaj.kuzan.utils;

import java.util.ArrayList;
import java.util.List;

public class DataComparator {

    public static List<Double> compareVectors(List<Double[]> originalVectors, Double[] noisedVector) {

        List<Double> similarityList = new ArrayList<>();

        for (Double[] input : originalVectors) {

            System.out.println("input - " +input.length);

            int similarity = 0;
            int comparableDataSize = 0;


            for (int i = 0; i < noisedVector.length; i++) {
                if(!noisedVector[i].equals(-1.0)){
                    if (input[i].equals(noisedVector[i])) {
                        similarity++;
                    }
                    comparableDataSize++;
                }
            }
            similarityList.add((double) similarity / (double) comparableDataSize * 100.0);
        }

        return similarityList;
    }
}
